home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
T-TPUG Old Monthly Disks
/
(c)tt.d64
/
ponzo tutor-3.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
19KB
|
529 lines
0 RUN00100
1 REM"
2 [143]" PONZ0*1983*WATERLOO
3 REM"
100 [151]53281,15:[151]53280,12:[153]"STOP":[153]"LOAD C64 TUTOR-3
101 PRINT"[176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
102 PRINT"[221] MORE ON THE C64 [146] [221]":MS$=" WELCOME! "
103 PRINT"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189][144]"
104 SN$="1000":GOSUB63200:GOSUB63600
105 GOSUB60000:GOSUB59000
1000 GOSUB60000
1010 PRINT"[147][209]I STORE INFO IN 8 (BINARY) BIT "CHR$(34)"BYTES"CHR$(34)"."
1020 PRINT"[209]SINCE 2^8=256, EACH BYTE CAN HOLD A"
1030 PRINT" NUMBER FROM 0 TO 255 INCLUSIVE."
1040 PRINT"[209]TWO BYTES ARE USED TO ADDRESS"
1050 PRINT" 2^16 MEMORY LOCATIONS:0,1,2,...,65535"
1060 PRINT"[209]YOU CAN FIND WHAT'S IN EACH BY PEEK[146]ING:"
1070 PRINT"FOR I=100 TO 200:PRINT PEEK(I);:NEXT"
1080 PRINT"[209]THIS MAY BE ENTERED DIRECTLY"
1090 PRINT" AND WILL PRINT THE CONTENTS"
1100 PRINT" OF LOCATIONS 100 TO 200."
1110 PRINT"[209]SOME OF M[146]EMORY IS R[146]EAD O[146]NLY(ROM)."
1120 PRINT"[209]SOME IS R[146]ANDOM A[146]CCESS(RAM)."
1130 PRINT"[209]YOU CAN WRITE INTO RAM BY POKE[146]ING."
1140 PRINT" POKE1100,1"
1145 PRINT"[209]THIS WILL PUT THE NO. 1 IN LOC'N 1100."
1146 GOSUB63000
1160 PRINT"[147]NOTE[146]: FOR POKE M,N "
1170 PRINT:PRINT"[209]M[146] MUST BE IN [0,65535],N[146] IN [0,255]."
1180 PRINT"[209]I USE 0 THRU' 1023 MYSELF..YOU USE "
1190 PRINT" 2048 TO 40959 FOR BASIC[146] PROGRAMS.."
1195 PRINT"[209]I USE 1024 THRU' 2047
1200 [153]" TO STORE THE 1000 CHARACTERS APPEARING"
1210 [153]" ON THE SCREEN,ETC.ETC"
1211 [153]"(NOTE:80 COLUMN PETS HAVE 2000)
1220 PRINT"SCREEN MEMORY[146]"
1230 PRINT"[209]THESE 1000 LOC'NS START AT $0400"
1240 PRINT" 0400(HEXADECIMAL)=4*256=1024(DECIMAL)"
1245 PRINT"[209]YOU CAN CHANGE WHAT'S"
1250 PRINT" ON THE SCREEN WITH A PRINT[146] STATEMENT"
1260 PRINT" PRINT "CHR$(34)"ABC"CHR$(34)
1270 PRINT" OR BY 'POKEING' SCREEN MEMORY:"
1280 PRINT" POKE1100,1"
1290 PRINT"[209]THIS PUTS 1[146] INTO SCREEN MEMORY LOC'N"
1300 PRINT" 1100, AND 1[146] CORRESPONDS TO AN "CHR$(34)"A"CHR$(34)
1310 PRINT" SO I'LL PRINT THE LETTER "CHR$(34)"A"CHR$(34)
1316 GOSUB63000
1320 PRINT"[147]TO SEE WHAT NO. IN [0,255] CORRESPONDS"
1330 PRINT"TO WHICH SYMBOL, YOU CAN TRY THIS:"
1340 PRINT"10 FOR I=0 TO 255"
1350 PRINT"20 POKE1024+I,I "
1360 PRINT"30 NEXT "
1370 PRINT"..AND TRY POKE1100,N[146]"
1371 PRINT"WITH 'N'=0,1,2,...OR 255.":MS$=" TRY IT![146]"
1380 PRINT"THEN TYPE @[146] TO CONTINUE!":GOSUB63100
1385 GOSUB63000:PRINT""
1390 SN$="02000":GOTO63300
2000 GOSUB60000:PRINT"[147][166][166][166][166][166][166]SOME SPECIAL LOCATIONS[146][166][166][166][166]"
2010 PRINT:PRINT"[209]IN 197 I KEEP TRACK OF WHAT KEY IS"
2020 PRINT" DEPRESSED. TO SEE THE KEY[146] VS. NUMBER"
2030 PRINT" CORRESPONDENCE, TRY:"
2040 PRINT"50 PRINT PEEK(197);"
2050 PRINT"60 GO TO 50 "
2060 PRINT"THEN RUN AND BANG ON A KEY!"
2065 PRINT"THEN TYPE @[146] TO CONTINUE."
2070 SN$="03000":GOTO63300
3000 GOSUB60000
3010 PRINT"[147]PRINTCHR$(14) WILL CAUSE"
3040 PRINT"ME TO SWITCH TO "CHR$(34)"LOWER"CHR$(34)" CASE."
3050 PRINT"YOU MIGHT LIKE TO TRY IT!"
3060 PRINT"IN PARTICULAR, TRY RUNNING:"
3070 PRINT"10 FOR I=0 TO 255 "
3071 PRINT"20 POKE1024+I,I "
3072 PRINT"30 PRINTCHR$(14+K);"
3073 PRINT"40 K=128-K:NEXT "
3080 MS$="DO A CHR$[146]!":GOSUB63100
3085 PRINT"...THEN TYPE @[146] TO CONTINUE"
3090 SN$="04000":GOTO63300
4000 POKE59468,12:GOSUB60000
4020 PRINT"PRINTCHR$(142)
4030 [153]"WILL PUT ME BACK TO UPPER CASE."
4040 [153]"(null)IN 160,161 & 162 I KEEP THE TIME"
4050 [153]" ...FROM THE MOMENT YOU TURN ME ON."
4060 [153]"(null)I'VE GOT A BUILT-IN "
4070 [153]" CRYSTAL-CONTROLLED CLOCK."
4080 [153]" I KEEP THE NUMBER OF JIFFIESWAIT IN"
4090 [153]" MEMORY LOC'NS 160,161,162"
4100 [153]" A JIFFIEWAIT IS 1/60 SECOND."
4110 [153]"(null)YOU COULD WRITE A PROGRAM TO CONVERT"
4120 [153]" THIS TO HOURS:MINUTES:SECONDS.."
4130 [153]" OR YOU COULD USE MY BUILT-IN ROUTINE!"
4140 [153]"100 PRINT TI$"
4150 [153]" HERE,TI$ WILL GIVE HHMMSS LIKE SO:":[153]"015209"
4155 [153]"01WAIT=HOURS 52WAIT=MINUTES 09WAIT=SECONDS.":[141]63000
4160 [153]"LOADI'LL PRINT OUT TI$ SO YOU CAN SEE HIM:"
4170 AA$[178]TI$:H$[178][200](AA$,2):M$[178][202](AA$,3,2):S$[178][201](AA$,2)
4175 [129]T[178]1[164]500:[130]
4180 [153]" "AA$
4190 [153]" ^ THAT'S HIM!"
4195 [153]"IT'S BEEN:"
4196 [153]""H$"WAIT HOURS,"M$"WAIT MINUTES & "S$"WAIT SECONDS"
4197 [153]"SINCE YOU TURNED THE C64WAIT ON!"
4200 [153]"RETURNWAIT..":[141]63001
4240 [153]"LOADYOU CAN SET THE CORRECT TIME BY TYPING:"
4250 [153]"TI$="[199](34)"093000"[199](34)
4260 [153]"THEN I'LL COUNT JIFFIES STARTING WITH"
4270 [153]"A COUNT CORRESPONDING TO 9:30 A.M."
4280 [153]"(000000=MIDNIGHT!!)":[141]63000
4290 [153]"LOADTHE VARIABLE TIWAIT GIVES THE JIFFIE-COUNT"
4300 [153]"I'LL PRINT HIM TOO:":[129]T[178]1[164]500:[130]:[153]""
4310 [153]" "TI
4320 [153]" ^ THAT'S HIM!"
4330 [153]"PLEASE, DON'T USE TI$WAIT OR TIWAIT FOR ANY"
4340 [153]"OF YOUR VARIABLE NAMES!"
4350 [153]" USRUSRUSRUSR
4361 PRINT"RETURN[146]..":GOSUB63001
4400 PRINT"[147][166][166][166][166][166][166][166][166][166]INPUT/OUTPUT[146][146][166][166][166][166][166][166][166][166]"
4410 PRINT"[209]TO WRITE DATA ON TAPE YOU "
4420 PRINT" OPEN A WRITE CHANNEL TO THE CASSETTE"
4430 PRINT"[209]YOU'LL WANT TO GIVE THE DATA A NAME[146],TOO"
4440 PRINT" AND YOU'LL WANT TO DISTINGUISH BETWEEN"
4450 PRINT" WRITING[146] TO TAPE AND READING[146] FROM TAPE."
4460 PRINT"200 OPEN3,1,1,"CHR$(34)"DATA"CHR$(34)"[146]"
4470 PRINT"OPEN A CHANNEL(#3)TO THE TAPE DRIVE(#1)"
4480 PRINT" FOR WRITING[146] (THE LAST #1 MEANS WRITE[146])"
4490 PRINT"210 FOR I=1TO10"
4500 PRINT"220 PRINT#3,I "
4510 PRINT"230 NEXT "
4520 PRINT"240 CLOSE 3 "
4530 PRINT"[209]THIS WRITES THE NUMBERS 1,2,..10"
4540 PRINT" ON THE TAPE-FILE CALLED "CHR$(34)"DATA"CHR$(34)
4560 GOSUB63000
4570 PRINT"[147]IT'S VERY IMPORTANT TO CLOSE[146] THE "
4580 PRINT"WRITE CHANNEL AFTER PRINTING TO TAPE!!"
4590 PRINT"(ELSE I WON'T PRINT AN END-MARKER"
4600 PRINT"AND MAY NOT WRITE THE LAST BIT OF DATA)."
4620 PRINT"[209]TO READ[146] A FILE(CALLED,SAY,'DATA')"
4630 PRINT"300 OPEN2,1,0,"CHR$(34)"DATA"CHR$(34)
4635 PRINT"310 FOR I=1TO10 "
4640 PRINT"320 INPUT#2,A(I) "
4650 PRINT"330 NEXT "
4660 PRINT"HERE THE READ[146] CHANNEL IS #2"
4670 PRINT"..THE LAST #0 MEANS READ[146]"
4680 PRINT"IT IS ASSUMED THERE ARE 10 NO'S TO READ."
4700 GOSUB63000
4710 PRINT"[147]A PRINT# STATEMENT:"
4720 PRINT"220 PRINT#3,I"
4730 PRINT"WILL WRITE THE VALUE OF I,FOLLOWED BY"
4740 PRINT"A RETURN[146] & SPACES[146]!"
4745 PRINT"YOU DON'T WANT THE 'SPACES'[146]!"
4750 PRINT"THE CORRECT WAY IS:"
4760 PRINT"220 PRINT#3,I;CHR$(13);"
4770 PRINT"HERE YOU[146] SPECIFY THE RETURN[146]=CHR$(13)"
4775 PRINT"..WITHOUT SPACES...."
4780 PRINT"THE ;[146] AT THE END AVOIDS 'LINE FEED' TOO!":GOSUB63000
4790 PRINT"[147]THE STATEMENT:"
4800 PRINT"240 CLOSE 3"
4810 PRINT"WRITES AN END-OF-FILE MARKER ON TAPE."
4820 PRINT"WHEN READ[146]ING DATA YOU CHECK FOR THIS:"
4830 PRINT"IF ST=64 THEN [146]..."
4840 MS$=" CLOSE[146]!":GOSUB63100
4850 GOSUB63000
4860 PRINT"[147]THE WRITE TO TAPE[146] ROUTINE IS THEN:"
4870 PRINT"200 OPEN3,1,1,"CHR$(34)"DATA"CHR$(34)" "
4880 PRINT"210 FOR I=1TO10 "
4890 PRINT"220 PRINT#3,I;CHR$(13);"
4900 PRINT"230 NEXT "
4910 PRINT"240 CLOSE 3 "
4920 PRINT"THE READ FROM TAPE[146] ROUTINE IS:"
4930 PRINT"300 OPEN2,1,0,"CHR$(34)"DATA"CHR$(34)" "
4940 PRINT"310 INPUT#2,A(J) "
4950 PRINT"320 IF ST<>64THENJ=J+1:GOTO310"
4960 PRINT"330 CLOSE2 "
4970 GOSUB63000:SN$="05000":GOSUB63600
5000 GOSUB60000
5005 PRINT"[147]TO CREATE A FILE[146]:"
5010 PRINT"10 OPEN15,8,15,"CHR$(34)"I"CHR$(34)"+DR$ "
5020 PRINT"20 OPEN2,8,2,DR$+"CHR$(34)":"CHR$(34)"+NM$+"CHR$(34)",S,W"CHR$(34)
5030 PRINT"30 PRINT#2,A;CHR$(13); "
5040 PRINT"DR$[146] IS DRIVE # [201]PREVIOUSLY"
5050 PRINT"NM$[146] IS FILE NAME [203]DEFINED!"
5060 PRINT"10[146] OPENS THE COMMAND CHANNEL #15"
5070 PRINT"AND I[146]NITIALIZES THE DRIVE DR$."
5075 PRINT"(NOT NECESSARY ON 'NEWER' DRIVES)."
5080 PRINT"20[146] OPENS A W[146]RITE CHANNEL,#2,"
5090 PRINT"FOR A S[146]EQUENTIAL(DATA) FILE CALLED NM$"
5100 PRINT"30[146] PRINTS A NUMBER,A[146],TO THE DATA FILE."
5110 PRINT"[209]YOU MAY REPEAT STATEMENT 30":PRINT"WITH VARIOUS A[146]'S,THEN.."
5120 PRINT"40 CLOSE2:CLOSE15":PRINT
5130 GOSUB63000
5140 PRINT"[147]TO READ FROM A FILE[146]:"
5150 PRINT"60 OPEN15,8,15,"CHR$(34)"I"CHR$(34)"+DR$ "
5160 PRINT"70 OPEN2,8,2,DR$+"CHR$(34)":"CHR$(34)"+NM$+"CHR$(34)",S,R"CHR$(34)
5170 PRINT"80 INPUT#2,A(J) "
5180 PRINT"90 IFST<>64THENJ=J+1:GOTO80 "
5190 PRINT"100 CLOSE2:CLOSE15 "
5195 PRINT"60[146] INITIALIZES ETC."
5200 PRINT"70[146] OPENS A R[146]EAD CHANNEL TO FILE NM$."
5210 PRINT"90[146] CHECKS FOR END-OF-FILE(STATUS=64)."
5216 GOSUB63000
5218 PRINT"[147]TO REITERATE[146]: WHEN WRITING DATA":PRINT"DO NOT[146] USE:"
5219 PRINT"PRINT#1,A,B$,C[146] OR PRINT#1,A;B$;C;[146]"
5220 PRINT"INSTEAD USE:"
5221 PRINT"PRINT#1,A;CHR$(13);B$;CHR$(13);..ETC"
5222 PRINT"IF IT'S PAINFULL TO TYPE 'CHR$(13)' THEN"
5223 PRINT"DEFINE CR$=CHR$(13) AND USE:"
5224 PRINT"PRINT#1,A;CR$;B$;CR$;C;CR$;[146]"
5226 GOSUB63000
5340 PRINT"[147][166][166][166][166][166][166][166][166]RANDOM NUMBERS[146][166][166][166][166][166][166][166][166][166][166][166]"
5350 PRINT"[209]I HAVE A RANDOM NUMBER GENERATOR[146]."
5360 PRINT"10 X=RND(K)"
5365 PRINT"[209]EACH NEGATIVE[146] K DETERMINES A"
5370 PRINT" UNIQUE SEED[146]. THEN:"
5375 PRINT"20 X1=RND(1)"
5380 PRINT"30 X2=RND(1)"
5385 PRINT"40 X3=RND(1)"
5390 PRINT"[209]HERE X1,X2,X3,..IS A 'RANDOM SEQUENCE'"
5391 PRINT" OF NUMBERS IN 0<X<1."
5395 PRINT"[209]SUBSEQUENT 'RND(1)' STATEMENTS YIELD"
5400 PRINT" SUCCESSIVE MEMBERS OF THE SEQUENCE.":GOSUB63000
5410 PRINT"[147][209]TO GET A RANDOM[146] SEED,USE:"
5415 PRINT"10 X=RND(-TI)"
5420 PRINT"WHERE TI[146] IS THE JIFFY[146] COUNT!"
5430 PRINT"[209]YOU CAN OBTAIN, USING RND(-K)"
5431 PRINT"FOLLOWED BY LOTS OF RND(1)[146]'S,"
5435 PRINT"A REPRODUCIBLE[146] 'RANDOM SEQUENCE'.":GOSUB63000
5440 PRINT"[147]IF YOU REALLY[146] WANT A RANDOM[146] NUMBER:"
5445 PRINT"10 X=RND(0)"
5450 PRINT"WILL GIVE YOU ONE. SUCCESSIVE 'RND(0)'"
5455 PRINT"STATEMENTS YIELD NO'S TOTALLY UNRELATED."
5456 MS$="SO IT SAYS":GOSUB63100
5465 GOSUB63000
5470 PRINT"[147]OF COURSE X=100+100*RND(0)[146] GIVES "
5475 PRINT" A NUMBER IN THE RANGE:0-100"
5476 FORT=1TO500:NEXT
5477 POKE54272,0:POKE54273,0:POKE54274,4000AND255:POKE54275,4000/256
5478 POKE54276,0:POKE54277,0:POKE54278,240
5480 PRINT"10 POKE54296,15:POKE54278,240"
5485 PRINT"20 FORI=1TO100:POKE54276,17 "
5490 PRINT"30 POKE54273,100+100*RND(0) "
5495 PRINT"40 NEXT "
5496 PRINT"CAN YOU GUESS WHAT ^[146] WILL DO???":GOSUB63000
5505 POKE54296,15:POKE54276,17:FORI=0TO100
5510 POKE54273,100+100*RND(0):NEXT
5520 POKE54296,0:POKE54277,0
5530 MS$="BEAUTIFUL!":GOSUB63100:GOSUB63000
6000 PRINT"[147][166][166][166][166][166][166][166][166][166]ODDS 'N' ENDS[146][166][166][166][166][166][166][166][166][166]"
6005 PRINT"[166][166][166][166][166][166]1[146][166][166][166][166][166][166]"
6010 PRINT"10 INPUT A$"
6020 PRINT" HIT 'RETURN' WHEN ASKED TO 'INPUT',"
6030 PRINT"AND I LEAVE A$ UNCHANGED."
6040 PRINT"TO AVOID THIS, YOU CAN USE:
6050 [153]"10 INPUT"[199](34)
6060 [153]"ON"[163]10)" 7LEFT$LEFT$LEFT$WAIT"[199](34)";A$"
6070 [153][163]10)" ^ ^"
6080 [153][163]10)" 3 3"
6090 [153][163]10)"SPC CRSR LEFT"
6100 [153]"THIS GIVES.."
6110 [133]" 7CMDCMDCMD";A$
6120 [153]"ONONONHIT 'RETURN' AND I SET A$='7'"
6130 [141]63000
6140 [153]"LOADOF COURSE"
6150 [153]"10 INPUT"[199](34)
6160 [153]"ON"[163]9)"OK YLEFT$LEFT$LEFT$WAIT"[199](34)";A$"
6170 [153]"IS NICE TOO."
6180 [133]"OK YCMDCMDCMD";A$
6190 [141]63000
7000 [153]"LOADSPC(SPC(SPC(SPC(SPC(SPC(2WAITSPC(SPC(SPC(SPC(SPC(SPC("
7010 [153]"?FRE(0)"
7020 [153]"AND I GIVE YOU THE NUMBER
7030 PRINT"OF 'FREE' BYTES OF MEMORY."
7040 PRINT"[166][166][166][166][166][166]3[146][166][166][166][166][166][166]"
7050 PRINT"OPEN4,4:CMD4:LIST"
7060 PRINT"LISTS YOUR PROGRAM ON THE PRINTER."
7070 PRINT"(BUT, AFTER LISTING, TYPE:"
7080 PRINT"PRINT#4:CLOSE4"
7090 PRINT"TO PROPERLY CLOSE THE PRINTER CHANNEL."
7100 GOSUB63000
8000 PRINT"[147][166][166][166][166][166][166]4[146][166][166][166][166][166][166]"
8010 PRINT"10 FORI=1TO1000:NEXT"
8020 PRINT"IS GOOD FOR BUILDING IN DELAYS."
8030 PRINT"BUT THE FOLLOWING IS OK TOO:"
8040 PRINT"10 A=TI [146] A=THE CURRENT TIME"
8050 PRINT"20 IFTI<A+60THEN20"
8060 PRINT"THIS WAITS FOR 60 JIFFIES=1SECOND."
8070 GOSUB63000
9000 PRINT"[147][166][166][166][166][166][166]5[146][166][166][166][166][166][166]"
9010 PRINT"THE C64 'KEYBOARD BUFFER' HOLDS 10 BYTES."
9020 PRINT"IF YOU RUN:"
9030 PRINT"10 FORI=1TO3000:NEXT"
9040 PRINT"20 FORI=1TO10:GETA$:?A$;:NEXT"
9050 PRINT"THEN, DURING THE DELAY, YOU CAN HIT"
9060 PRINT"10 KEYS (OR LESS) AND THEY WILL BE "
9070 PRINT"SAVED IN THE BUFFER."
9080 PRINT"BUT[157][157][157][184][184][184][145]..DON'T HIT > 10 KEYS!"
9085 PRINT"(ELSE I WON'T GET THEM ALL)"
9090 PRINT"TRY IT? THEN:"
9100 PRINT"TYPE @ [146]":SN$="10000":GOTO63300
10000 GOSUB60000:PRINT"[147][166][166][166][166][166][166]6[146][166][166][166][166][166][166]"
10010 PRINT"MEMORY LOCATION 198 (DECIMAL) HOLDS"
10020 PRINT"THE NUMBER OF CHARACTERS IN THE "
10030 PRINT"KEYBOARD BUFFER."
10040 PRINT"YOU CAN CLEAR THE BUFFER WITH:"
10050 PRINT"10 FORI=1TO10:GETA$:NEXT"
10060 PRINT"OR"
10070 PRINT"10 GETA$:IFA$<>"CHR$(34)CHR$(34)"THEN10"
10080 PRINT"OR"
10090 PRINT"10 POKE198,0"
10100 GOSUB63000
11000 PRINT"[147][166][166][166][166][166][166]7[146][166][166][166][166][166][166]"
11010 PRINT"MEMORY LOCATIONS 55 AND 56 HOLD THE"
11020 PRINT"LOCATION OF THE 'END OF BASIC MEMORY'."
11030 PRINT"PRINT IT OUT BY TYPING:"
11040 PRINT"?PEEK(55)+256*PEEK(56)"
11050 PRINT"THEN TYPE @"
11060 PRINT"?PEEK(55)+256*PEEK(56)[145]":SN$="12000":GOTO63300
12000 GOSUB60000:X=32768
12020 PRINT"[147][166][166][166][166][166][166]8[146][166][166][166][166][166][166]TOP="X
12030 PRINT"IF YOU WANT TO STORE SOME NUMBERS"
12040 PRINT"FOR SAFE KEEPING, YOU CAN CHANGE THE"
12050 PRINT"TOP OF BASIC MEMORY, BY POKING A NEW[157][157][157][184][184][184]"
12060 PRINT"'TOP' INTO 55 & 56, SO THE NEW TOP IS":X$=MID$(STR$(X-100),2)
12070 PRINT"SAY, "X$", GIVING YOU 100 PLACES"
12080 PRINT"TO STORE YOUR NUMBERS."
12090 PRINT"HOW TO STORE THEM? POKE[146] THEM INTO RAM!"
12100 PRINT"10 FORI=0TO99:POKE"X$"+I,A(I):NEXT":GOSUB63000
13000 PRINT"[147][166][166][166][166][166][166]9[146][166][166][166][166][166][166]"
13010 PRINT"EVERY JIFFY (60 TIMES/SECOND) I"
13020 PRINT"STOP WHAT I'M DOING AND UPDATE THE"
13030 PRINT"JIFFY CLOCK,AND..AMONG OTHER THINGS.."
13040 PRINT"CHECK TO SEE IF YOU PRESSED THE"
13050 PRINT"RUN/STOP[146] KEY..."
13060 PRINT"..AND, IF SO, THEN I WILL STOP![157][157][157][157][157][184][184][184][184]"
13070 PRINT"I DO THESE THINGS (60 TIMES/SECOND)"
13080 PRINT"BY JUMPING TO A MAGIC MEMORY LOCATION."
13090 GOSUB63000
13100 PRINT"[147]THIS MAGIC LOCATION IS STORED IN"
13110 PRINT"MEMORY LOCATIONS 788 & 789."
13120 PRINT"I JUMP TO PEEK(788)+256*PEEK(789)"
13130 PRINT"HOLD ON..I'LL TELL YOU WHERE I JUMP...":GOSUB63000
13140 PRINT"[147]....IT'S TO";
13150 A9=7*4096+15*256+14*16+10:ML=PEEK(A9)+256*PEEK(A9+1):PRINT""ML
13160 PRINT"AT LOCATION"ML" ARE INSTRUCTIONS"
13170 PRINT"WHICH CHECK FOR STOP[146], ETC.."
13180 PRINT"YOU CAN BYPASS THE 'CHECK FOR STOP'"
13190 PRINT"BY HAVING ME JUMP TO "ML+3"[146]!!"
13200 PRINT"..SIMPLY POKE788,PEEK(788)+3"
13210 PRINT"IN A PROGRAM AND STOP[146] WILL BE IGNORED!"
13220 GOSUB63000
13230 PRINT"[147]BUT REMEMBER TO POKE788,PEEK(788)-3"
13240 PRINT"LATER IN THE PROGRAM.."
13250 PRINT"CARE (DARE) TO TRY IT??"
13260 PRINT"REMEMBER:"
13270 PRINT"POKE788,PEEK(788)+3"
13280 PRINT"THEN WRITE A PROGRAM LIKE:"
13290 PRINT"10 FORI=1TO10000:NEXT"
13300 PRINT"AND TRY TO STOP IT."
13400 PRINT"EVENTUALLY..TYPE:"
13410 PRINT"POKE788,PEEK(788)-3"
13420 PRINT"..COME TO THINK OF IT.."
13430 PRINT"TRY IT AFTER[146] YOU'VE ENDED TUTOR[146]!":GOSUB63000
14000 PRINT"[147]THE SYS COMMAND"
14010 PRINT"I DON'T UNDERSTAND 'BASIC'."
14020 PRINT"I UNDERSTAND 'MACHINE LANGUAGE'."
14030 PRINT"HOWEVER I HAVE A BUILT-IN INTERPRETER"
14040 PRINT"WHO UNDERSTANDS BOTH!"
14050 PRINT"HE TRANSLATES YOUR BASIC COMMANDS"
14060 PRINT"INTO MACHINE LANGUAGE COMMANDS FOR ME."
14070 PRINT"THIS 'BASIC INTERPRETER' IS A SET OF"
14080 PRINT"MACHINE LANGUAGE INSTRUCTIONS WHICH"
14090 PRINT"RESIDE IN MEMORY FROM 40960."
14105 PRINT"THAT IS: $A000"
14110 GOSUB63000
14120 PRINT"[147]MACHINE LANGUAGE INSTRUCTIONS ARE"
14130 PRINT"NUMBERS FROM 0 TO 255..AND EACH MEANS"
14140 PRINT"SOMETHING SPECIAL."
14150 PRINT"FOR EXAMPLE THE SEQUENCE OF NUMBERS:"
14160 PRINT"169[146] 170[146] 141[146] 0[146] 4[146]"
14170 PRINT"SAYS TO PUT AN ASTERISK IN THE UPPER"
14180 PRINT"LEFT CORNER OF THE SCREEN."
14190 PRINT"HERE ARE SOME 'INSTRUCTIONS' TAKEN FROM"
14200 PRINT"THE INTERPRETER 'HIMSELF' (HERSELF?):":GOSUB63000:PRINT"[145][145][145][145][145][145][145]"
14210 FORI=0TO15:PRINTPEEK(40960+I);:FORJ=1TO100:NEXT:NEXT
14230 GOSUB63000
14240 PRINT"[147]OK...IF YOU CAN TALK MACHINE LANGUAGE"
14250 PRINT"THEN YOU CAN PUT YOUR M-L PROGRAM"
14260 PRINT"INTO MEMORY STARTING AT SOME"
14270 PRINT"LOCATION, SAY 20000, THEN SYS 20000"
14280 PRINT"WILL SEND ME THERE TO OBEY."
14290 PRINT"YOU MIGHT STICK YOUR PROGRAM UP AT THE"
14300 PRINT"'TOP OF BASIC RAM' SOMEWHERE AND"
14310 PRINT"PROTECT IT FROM BEING OVERWRITTEN"
14320 PRINT"BY CHANGING 'TOP' (AT 55/56 REMEMBER?)"
14330 GOSUB63000
14340 PRINT"[147]"
14350 PRINT"10 FORI=25000TO25024:READK:POKEI,K:NEXT:END"
14360 PRINT"20 DATA 162,4,160,4,132,177,160,0,132,176,177,176,73,128"
14370 PRINT"30 DATA 145,176,200,208,247,230,177,202,208,242,96"
14371 PRINT"RUN10"
14372 PRINT"SYS25000"
14375 PRINT"HERE'S A M-L PROGRAM YOU CAN TRY"
14380 PRINT"ENTER THESE, THEN RUN10[146], THEN SYS25000"
14390 PRINT"(THEN TYPE @[146] TO CONTINUE)"
14400 PRINT"":SN$="15000":GOTO63300
15000 GOSUB60000:PRINT"[147]":MS$=" SLICK EH?[146]":GOSUB63100
15010 PRINT"[147]ONE M-L INSTRUCTION WHICH IS NICE"
15020 PRINT"IS ZERO (I MEAN 0)."
15030 PRINT"THIS INSTRUCTION TELLS ME TO JUMP TO THE"
15040 PRINT"'M[146]ACHINE L[146]ANGUAGE M[146]ONITOR'."
15050 PRINT"(I LIKE THE MLM[146] SO MUCH I SOMETIMES"
15060 PRINT"JUMP THERE ON MY OWN!)"
15070 PRINT"TO GET OUT OF THE MLM JUST TYPE AN 'X'"
15080 PRINT"AND HIT THE 'RETURN' KEY."
15085 GOSUB63000
15090 PRINT"[147]LET'S TRY JUMPING TO THE MLM."
15100 PRINT"HIT A KEY WHEN YOU'RE READY TO TRY."
15110 PRINT" REMEMBER HOW TO GET OUT! "
15115 PRINT" TYPE 'X' THEN HIT 'RETURN' "
15120 PRINT"THEN @[146] TO CONTINUE..":SN$="16000":GOSUB63600
15130 GOSUB63001:SN$="16000":GOSUB63600
15140 SYS2048:GOSUB63000
16000 GOSUB60000:PRINT"[147]OK..IF YOU[157][157][157][184][184][184][145] WANT TO ENTER THE MLM"
16010 PRINT"YOU CAN FIND ANY MEMORY LOCATION WHICH"
16020 PRINT"CONTAINS '0' AND SEND ME THERE WITH SYS[146]."
16030 PRINT"ONE GOOD PLACE IS 2048. IT ALWAYS.."
16040 PRINT".....WELL , ALMOST ALWAYS...."
16050 PRINT"CONTAINS '0'."
16060 PRINT"TRY SYS2048[146]. (REMEMBER 'X' TO EXIT)"
16070 PRINT"THEN TYPE @[146] TO CONTINUE..":SN$="17000":GOTO63300
17000 GOSUB60000:PRINT"[147]ONCE IN THE MLM YOU CAN DISPLAY THE"
17010 PRINT"CONTENTS OF MEMORY MORE EASILY THAN"
17020 PRINT"WITH PEEK(THIS) AND PEEK(THAT)."
17030 PRINT"HAVING DONE YOUR SYS2048[146] I'LL GIVE"
17040 PRINT"B*"
17050 PRINT" PC SR AC XR YR SP
17060 [153]".; 0801 30 30 3A 2A F7
17070 PRINT".
17080 [153]"NOW IF YOU TYPE :"
17090 [153]".M A000 A00F"
17100 [153]"SO IT LOOKS LIKE:"
17105 [141]63000
17110 [153]"LOADB*"
17120 [153]" PC SR AC XR YR SP
17130 PRINT".; 0801 32 04 5E 00 F8
17140 [153]".M A000 A00F
17150 PRINT"THEN HIT 'RETURN'...I'LL DISPLAY MEMORY"
17160 PRINT"FROM A000 TO A00F (THAT'S HEXADECIMAL!)"
17170 PRINT"TRY IT! (REMEMBER 'X' TO EXIT MLM)":PRINT"THEN TYPE @[146]"
17180 SN$="18000":GOTO63300
18000 GOSUB60000:PRINT"[145][145][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166]"
18005 PRINT"NOTICE THAT THE NUMBERS I DISPLAY ARE"
18010 PRINT"IN HEXADECIMAL[146]!"
18020 PRINT"IN FACT YOU'VE SEEN THEM BEFORE."
18030 PRINT"THEY'RE FROM 'THE INTERPRETER'."
18040 PRINT"I LAST GAVE THEM TO YOU IN 'DECIMAL'."
18050 PRINT"(PEEK[146] ALWAYS GIVES DECIMAL)"
18060 GOSUB63000:PRINT"[147]"
18070 MS$="AU REVOIR![146]":GOSUB63100:GOSUB63500:END
59000 PRINT"[147]":GOSUB63100
59001 PRINT"DURING THE TUTORIAL YOU MAY WISH"
59002 PRINT"TO RETURN TO AN EARLIER 'PAGE'."
59003 PRINT"JUST HIT THE @-KEY[146], AT ANY TIME,"
59004 PRINT"AND THE TUTORIAL WILL BACK UP"
59005 PRINT"A PAGE OR TWO."
59006 PRINT"ALSO, YOU HAVE AN OPPORTUNITY TO"
59007 PRINT"COMPOSE YOUR OWN PROGRAMS."
59008 PRINT"WHEN YOU WISH TO CONTINUE WITH"
59009 PRINT"THE TUTORIAL, HIT THE @-KEY[146]!":GOSUB63000
59010 MS$="@[146]_REMEMBER":GOSUB63100
59020 GOSUB63000:RETURN
60000 POKE204,1:REM INITIALIZE
60001 BT$="":FORI=1TO24:BT$=BT$+"":NEXT
60002 PT$="[176][192][192][192][192][192][192][192][192][192][192][174][157][157][157][157][157][157][157][157][157][157][157][157][221][221][157][157][157][157][157][157][157][157][157][157][157][157][173][178][192][192][192][192][192][192][192][192][178][189]"
60003 PT$=PT$+"[157][157][157][157][157][157][157][157][157][157][157][157][157][206][163][163][163][163][163][163][163][163][163][163][163][163][205][157][157][157][157][157][157][157][157][157][157][157][157][157][157][165]============[167]"
60004 PT$=PT$+"[157][157][157][157][157][157][157][157][157][157][157][157][157][157][208][207][163][163][163][163][163][163][163][163][163][163][208][207][145][145][145][145][157][157][157][157][157][157][157][157][157][157][157][157]"
60005 PT$=BT$+"[145][145][145][145][145][145]"+PT$+"[144]"
60007 ML$=""
60008 WD=40:CRT=1024:PRINTCHR$(142)
60009 W2=WD/2:W3=WD-1:W1$=MID$(STR$(WD),2):
60010 W2$=MID$(STR$(W2),2):W3$=MID$(STR$(W3),2)
60020 PRINT"[147]":POKE53281,15:POKE53280,12:PRINT"[144]"
60998 IFPEEK(789)<>7*16+15THENSYS(7*4096+15*256+12*16+3)
60999 RETURN
61000 REM*NEW WORKSPACE
61001 M=7*4096+15*256+15*16
61002 RESTORE
61003 FORI=MTOM+15:READK:POKEI,K:NEXT
61004 DATA 1,96,3,96,3,96,3,96
61005 DATA 144,127,0,0,144,127,0,0
61006 M=6*4096:FORI=0TO2:POKEM+I,0:NEXT
61007 RETURN
63000 PRINT"HIT RETURN[146] TO CONTINUE";
63001 GETA$:IFA$<>""THEN63001
63002 GETA$:IFA$=""THEN63002
63003 RETURN
63100 FORT=1TO5:PRINTPT$MS$;
63101 PRINTPT$" ";
63102 PRINTPT$MS$;:NEXT
63103 PRINT:RETURN
63200 POKE56,96:POKE52,96:POKE55,0:POKE51,0:GOSUB61000
63201 WD=40:CRT=1024:POKECRT,96:IFPEEK(CRT+1024)<>96THENWD=80:PRINTCHR$(142)
63202 M=7*4096+15*256+9*16
63203 FORI=MTOM+91:READK:POKEI,K:NEXT
63204 DATA165,203,201,46,208,83,32,195,127,165,44,201,8,240,3,32,177,127,32
63205 DATA142,166,165,44,201,8,240,3,76,128,164,76,174,167,162,16,189,239
63206 DATA127,72,181,42,157,239,127,104,149,42,202,208,241,96,120,173,238,127
63207 DATA77,20,3,141,20,3,173,239,127,77,21,3,141,21,3,88,96,173,20,3,73
63208 DATA144,141,238,127,173,21,3,73,127,141,239,127,96,76,255,255
63216 POKEM+90,PEEK(788):POKEM+91,PEEK(789)
63220 KEY=7*4096+15*256+13*16+8
63221 SYS(KEY):REM KEY FOR IRQ SWAP
63299 RETURN
63300 REM*SWITCH TO NEW WORKSPACE
63301 GOSUB63600:REM RUN NUMBER
63302 GOSUB61000:REM NEW THE WORKSPACE
63303 GOTO63403
63400 REM*SWITCH TO OLD WORKSPACE
63401 GOSUB63600
63403 SWTCH=7*4096+15*256+9*16+15
63404 SYS(SWTCH):REM SWAP POINTERS
63405 POKE204,2:END
63500 REM*RESTORE PET
63501 SN$="100":GOSUB63600
63502 M=7*4096+15*256+12*16+3:IFPEEK(789)=7*16+15THENSYSM
63503 RETURN
63600 REM*INSERT RUN NUMBER
63601 M=2059:SN$="00000"+SN$
63602 FORI=1TO5:POKEM-I,ASC(RIGHT$(SN$,I)):NEXT:RETURN